<style>
.jyui_cell_col .red {color: red;}
.fui-icon-group.col-7 .fui-icon-col {width: 14.28%;}
.signed {position: absolute;top:0;right:0.2rem;color:red;}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: auto;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
</style>
<div ng-if="pagedata.showtimeset" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="height:25rem;overflow-y:scroll;padding-bottom:2.5rem">
		<div class="tips tips-yellow" style="margin:0">
               <i class="fa fa-bullhorn"></i> 设置本订单的预约定期配送方式，如果不会设置，可以让配送员或者店员帮忙设置！
         </div>
		<div class="fui-cellone" style="text-align:left">
				<div class="fui-cellone-info bold">预约配送日期选择！</div>
				<div class="fui-cellone-remark noremark">
				<span class="btn btn-sm btn-success" style="background:#18bc9c;line-height:2" ng-click="pagedata.post.peiset.days='';">清空全部</span>
				</div>
		</div>
		<div class="fui-cellone bold" style="padding:0;padding-bottom:0.3rem">
				<div ng-click="pagedata.upmonth(0);" class="fui-cellone-info" style="color:#18bc9c">
					<i class="icon icon-back" style="font-size:0.8rem"/>上月
				</div>
				<div class="fui-cellone-info c">
					{{pagedata.currentyear}}-{{pagedata.currentmonth}}
				</div>
				<div ng-click="pagedata.upmonth(1);" class="fui-cellone-info r" style="color:#18bc9c">
					下月<i class="icon icon-more" style="font-size:0.8rem"/>
				</div>
		</div>
		<div class="radius" style="background:#fff;padding-top:0.3rem">
				<div class="fui-icon-group noborder col-7">
					<div class="fui-icon-col" ng-repeat="week in pagedata.params.work_weekarray" style="margin-top:0">
						<label class="jyui_cell_col" style="color:#ddd">
							<div class="timetitle"><span>{{week}}</span></div>
						</label>
					</div>
				</div>
				<div class="fui-icon-group noborder col-7">
					<div class="fui-icon-col" ng-repeat="(k,value) in pagedata.kongday" style="margin-top:0">
						<label class="jyui_cell_col">
							
						</label>
					</div>
					<div class="fui-icon-col" ng-repeat="(k,value) in pagedata.calendar" style="margin-top:0" ng-click="duoxuans(value.day,pagedata.post.peiset,'days')">
						<label ng-class="{'jyui_cell_col':1,'disabled':value.islast==1}">
							<div ng-class="{'red':pagedata.post.peiset.days.indexOf(';'+value.day+';')>=0}">
								<span>{{value.i}}</span>
							</div>
						</label>
						<i ng-show="pagedata.post.peiset.days.indexOf(';'+value.day+';')>=0" class="icon icon-selected signed"></i>
					</div>
				</div>
				<div ng-click="pagedata.upall();" class="fui-cell-title c" style="color:#18bc9c;padding-top:0">
					<i class="icon icon-yuding" style="font-size:0.8rem"/>全选/取消
				</div>
		</div>
		<div class="fui-cellone" style="text-align:left">
				<div class="fui-cellone-info bold">预约配送时间段选择！</div>
				<div class="fui-cellone-remark noremark">
				<span class="btn btn-sm btn-success" style="background:#18bc9c;line-height:2" ng-click="pagedata.post.peiset.times='';">清空</span>
				</div>
		</div>
		<div class="radius" style="background:#fff">
			<div class="fui-cellone">
					<div class="fui-cellone-label" style="color:#18bc9c">早</div>
					<div class="fui-cellone-info"></div>
					<div class="fui-cellone-remark noremark" style="color:#18bc9c">预约早上时间</div>
				</div>
				<div class="fui-icon-group noborder col-3" style="padding:0 0.15rem">
					<div class="fui-icon-col" ng-repeat="item in pagedata.work_hours0" style="margin-top:0">
						<label class="jyui_cell_col" ng-click="duoxuans(item.timev,pagedata.post.peiset,'times')">
							<div ng-class="{'btn btn-gray':1,'red':pagedata.post.peiset.times.indexOf(';'+item.timev+';')>=0}" style="background:#f2f2f2;margin: 0.1rem;line-height:2">{{item.timev}}</div>
						</label>
						<i ng-show="pagedata.post.peiset.times.indexOf(';'+item.timev+';')>=0" class="icon icon-selected signed" style="top:0.3rem"></i>
					</div>
					<div class='content-empty' style="margin:0.5rem 0" ng-show="!pagedata.work_hours0 || pagedata.work_hours0.length<=0">
						<i class='icon icon-information'></i><br/>暂时没有可设置的时间!
					</div>
				</div>
				<div class="fui-cellone">
					<div class="fui-cellone-label" style="color:#18bc9c">中</div>
					<div class="fui-cellone-info"></div>
					<div class="fui-cellone-remark noremark" style="color:#18bc9c">预约中午时间</div>
				</div>
				<div class="fui-icon-group noborder col-3" style="padding:0 0.15rem">
					<div class="fui-icon-col" ng-repeat="item in pagedata.work_hours1" style="margin-top:0">
						<label class="jyui_cell_col" ng-click="duoxuans(item.timev,pagedata.post.peiset,'times')">
							<div ng-class="{'btn btn-gray':1,'red':pagedata.post.peiset.times.indexOf(';'+item.timev+';')>=0}" style="background:#f2f2f2;margin: 0.1rem;line-height:2">{{item.timev}}</div>
						</label>
						<i ng-show="pagedata.post.peiset.times.indexOf(';'+item.timev+';')>=0" class="icon icon-selected signed" style="top:0.3rem"></i>
					</div>
					<div class='content-empty' style="margin:0.5rem 0" ng-show="!pagedata.work_hours1 || pagedata.work_hours1.length<=0">
						<i class='icon icon-information'></i><br/>暂时没有可设置的时间!
					</div>
				</div>
				<div class="fui-cellone">
					<div class="fui-cellone-label" style="color:#18bc9c">晚</div>
					<div class="fui-cellone-info"></div>
					<div class="fui-cellone-remark noremark" style="color:#18bc9c">预约晚上时间</div>
				</div>
				<div class="fui-icon-group noborder col-3" style="padding:0 0.3rem">
					<div class="fui-icon-col" ng-repeat="item in pagedata.work_hours2" style="margin-top:0">
						<label class="jyui_cell_col" ng-click="duoxuans(item.timev,pagedata.post.peiset,'times')">
							<div ng-class="{'btn btn-gray':1,'red':pagedata.post.peiset.times.indexOf(';'+item.timev+';')>=0}" style="background:#f2f2f2;margin: 0.1rem;line-height:2">{{item.timev}}</div>
						</label>
					</div>
					<div class='content-empty' style="margin:0.5rem 0" ng-show="!pagedata.work_hours2 || pagedata.work_hours2.length<=0">
						<i class='icon icon-information'></i><br/>暂时没有可设置的时间!
					</div>
				</div>
		</div>
		 <div class="fui-navbar">
			<a ng-click="pagedata.showtimeset=false;" class="nav-item btn btn-danger confirmbtn">提交设置</a>
		</div>
</div>
</div>
</div>
<script language='javascript'>
scope.pagedata.gotoshowtime=function(){
	scope.get('jy_peimilk/setpei/get_work_time/',function(res){
		scope.pagedata.work_hours0=res.hours0;
		scope.pagedata.work_hours1=res.hours1;
		scope.pagedata.work_hours2=res.hours2;
		scope.$evalAsync();
	});
}
scope.pagedata.gotoshowtime();
scope.pagedata.getDates=function(){
	scope.get('jy_peimilk/setpei/time_days/year='+scope.pagedata.currentyear+'&month='+scope.pagedata.currentmonth,function(res){
		console.log(scope.pagedata.currentyear);
		scope.pagedata.kongday=res.kongday;
		scope.pagedata.calendar=res.calendar;
		scope.$evalAsync()
		return true;
	});
}
scope.pagedata.getDates();
scope.pagedata.upmonth=function(isadd){
	var currentmonth=parseInt(scope.pagedata.currentmonth);
	if(isadd==1){
		if(currentmonth==12){
			currentmonth=1
			scope.pagedata.currentyear++
		}else{
			currentmonth++
		}
	}
	if(isadd!=1){
		if(currentmonth==1){
			currentmonth=12
			scope.pagedata.currentyear--
		}else{
			currentmonth--
		}
	}
	if(currentmonth<10){
		scope.pagedata.currentmonth='0'+currentmonth
	}
	scope.pagedata.getDates();
	return true;
}
scope.pagedata.upall=function(){
	var calendar = Object.values(scope.pagedata.calendar)
	for(var i=0;i<calendar.length;i++){
		var value=calendar[i]
		scope.duoxuans(value,scope.pagedata.post.peiset,'days')
	}
	scope.$evalAsync();
}
</script>